package com.yunyao.dao.service.bamu.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yunyao.common.constant.enums.DataDeletedStatus;
import com.yunyao.dao.mapper.BamuSupplyApplyMaterialMapper;
import com.yunyao.dao.model.BamuSupplyApplyMaterial;
import com.yunyao.dao.service.bamu.IBamuSupplyApplyMaterialService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 合同材料表 服务实现类
 * </p>
 *
 * @author xingjishuai
 * @since 2024-07-02
 */
@Service
public class BamuSupplyApplyMaterialServiceImpl extends ServiceImpl<BamuSupplyApplyMaterialMapper, BamuSupplyApplyMaterial> implements IBamuSupplyApplyMaterialService {
    @Autowired
    BamuSupplyApplyMaterialMapper bamuSupplyApplyMaterialMapper;
    @Override
    public List<BamuSupplyApplyMaterial> hasSupplyMaterialList(String applyId) {
        return bamuSupplyApplyMaterialMapper.hasSupplyMaterialList(applyId);
    }

    @Override
    public BamuSupplyApplyMaterial getTotalByOrderId(String orderId) {
        return baseMapper.selectTotalByOrderId(orderId);
    }

    @Override
    public List<BamuSupplyApplyMaterial> getMaterialListByOrderId(String orderId) {
        LambdaQueryWrapper<BamuSupplyApplyMaterial> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(BamuSupplyApplyMaterial::getPurchaseApplyId, orderId).eq(BamuSupplyApplyMaterial::getIsDeleted, DataDeletedStatus.NO.getType());
        return baseMapper.selectList(wrapper);
    }

    @Override
    public List<BamuSupplyApplyMaterial> listByPurchaseApplyId(String purchaseApplyId) {
        LambdaQueryWrapper<BamuSupplyApplyMaterial> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(BamuSupplyApplyMaterial::getPurchaseApplyId, purchaseApplyId).eq(BamuSupplyApplyMaterial::getIsDeleted, DataDeletedStatus.NO.getType());
        return baseMapper.selectList(wrapper);
    }
}
